package com.kingmed.kmss.common.service.obs;

import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;

/**
 * 华为云OBS服务接口
 */
public interface HuaWeiYunOBSService {

    /**
     * @Description 删除文件
     */
    boolean delete(String filePathAndName);

    /**
     * @Description 批量删除文件
     */
    boolean delete(List<String> filePathAndNames);

    /**
     * @Description 上传文件
     */
    Map<String, String> fileUpload(MultipartFile uploadFile, String filePath);

    /**
     * @Description 上传文件
     */
    Map<String, String> fileUpload(String base64Img, String filePath);

    /**
     * @Description 上传文件不止图片
     */
    Map<String, String> fileUpload(String base64Img, String filePath, String fileType);

    /**
     * @Description 文件下载并反馈给前端
     */
    void fileDownload(HttpServletRequest request, HttpServletResponse response, String filePathAndName, Integer type) throws IOException;

    /**
     * @Description 文件下载获取文件流
     */
    InputStream fileDownload(String filePathAndName);

    /**
     * 文件批量下载并压缩成zip
     *
     * @param filePathAndNames
     * @param response
     * @return
     */
    void downLoadBatchToZip(String filePathAndNames, HttpServletResponse response) throws Exception;

    /**
     * 文件批量下载并压缩成zip
     *
     * @param filePathAndNames
     * @param response
     * @throws Exception
     */
    void downLoadBatchToZip(List<String> filePathAndNames, HttpServletResponse response) throws Exception;
}
